﻿<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="AjaxArrayJson.aspx.cs" Inherits="AjaxArrayJson" Title="Untitled Page" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="DemoTitleContentPlaceHolder" Runat="Server">
Example of using Ajax with JSON to/from the server.
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="DemoContentPlaceHolder" Runat="Server">

<script type="text/javascript">

var result = '';
function AjaxCallBack(ServerResult, Status) {
    debugger;
    if(Status == "success") {
        var result = eval('(' + ServerResult + ')');;
        result = ServerResult;
    }
}

function GatherSomeData() {
    debugger;
    return '{"SharedString":"Hello World","SharedDouble":6.0,"SharedInt":5,"Children":[{"SharedChildString":"Im a child from the client!!"}]}';
}
</script>

<asp:Button runat="server" ID="TriggerButton" Text="Click Me" OnClientClick="return false;" />
<asp:Label runat="server" ID="ResultLabel" Text="Results"></asp:Label>

<cc2:AjaxExtender runat="server" ID="AjaxExtender1"  
MethodName="ServerMethod" Callback="AjaxCallBack" TriggerSelector="#{TriggerButton}"
OnClientBeforeAjax="GatherSomeData();"
></cc2:AjaxExtender>
 
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="SourceContentPlaceHolder" Runat="Server">
</asp:Content>

